package com.wufun.overseas.joystick;

import android.content.Context;

import com.wufun.overseas.joystick.map.KeyMap;

/**
 * Created by xiet on 2015/6/18.
 */
public class KeyMapActions {

    public static void saveStat(Context context, KeyMap.EmuMap emuMap, String path) {
//        if (emuMap == null && context == null)
//            return;
//        int type = -1;
//        if (emuMap == KeyMap.EmuMap.FBA) {
//            type = JoyStickConfig.TYPE_FBA;
//        } else if (emuMap == KeyMap.EmuMap.GBA) {
//            type = JoyStickConfig.TYPE_GBA;
//        } else if (emuMap == KeyMap.EmuMap.SFC) {
//            type = JoyStickConfig.TYPE_SFC;
//        } else if (emuMap == KeyMap.EmuMap.PSP) {
//            type = JoyStickConfig.TYPE_PSP;
//        } else if (emuMap == KeyMap.EmuMap.FC) {
//            type = JoyStickConfig.TYPE_FC;
//        } else if (emuMap == KeyMap.EmuMap.MD) {
//            type = JoyStickConfig.TYPE_MD;
//        } else if (emuMap == KeyMap.EmuMap.PS) {
//            type = JoyStickConfig.TYPE_PS;
//        } else if (emuMap == KeyMap.EmuMap.WSC) {
//            type = JoyStickConfig.TYPE_WSC;
//        } else if (emuMap == KeyMap.EmuMap.GBC) {
//            type = JoyStickConfig.TYPE_GBC;
//        } else if (emuMap == KeyMap.EmuMap.DC) {
//            type = JoyStickConfig.TYPE_DC;
//        } else if (emuMap == KeyMap.EmuMap.N64) {
//            type = JoyStickConfig.TYPE_N64;
//        }
//
////        StatCore.getInstance().send(Event.joystickConfigChanged, "");
//        StatFactory.getInstance(context).sendDJoystickConfigChanged(AccountUtil_.getInstance_(context).getUid(), AccountUtil_.getInstance_(context).isTourist(),"","",0);
//        JoyStickConfig joyStickConfig = new JoyStickConfig();
//        AccountBean accountBean    = AccountUtil_.getInstance_(context).getAccountData();
//        if (accountBean != null)
//            joyStickConfig.setUid(accountBean.getUid());
//        joyStickConfig.setType(type);
//        joyStickConfig.setFile(path);
//        fillConnectedGamepadInfo(context, joyStickConfig);
//        joyStickConfig.setUpdate_time(new Date().getTime());
//
//        StatFactory.getInstance(context).sendJoyStickConfigPost(JsonMapper.nonDefaultMapper().toJson(joyStickConfig), AccountUtil_.getInstance_(context).getUid());
    }

//    private static void fillConnectedGamepadInfo(Context ctx, JoyStickConfig joyStickConfig) {
//        String                                   gamepadName   = "";
//        String                                   gamepadMac    = "";
//        String                                   split         = ";";
//        List<ControllerManager.ControllerDevice> connectedList = ControllerMonitor.getInstance(ctx).getControllerDevices();
//        if (connectedList != null) {
//            for (int i = 0; i < connectedList.size(); i++) {
//                gamepadName += connectedList.get(i).getName() + split;
//                gamepadMac += connectedList.get(i).getAddress().replace(":", "_") + split;
//            }
//        }
//        if (!gamepadName.equals("")) gamepadName.substring(0, gamepadName.length() - 1);
//        if (!gamepadMac.equals("")) gamepadMac.substring(0, gamepadName.length() - 1);
//        joyStickConfig.setGamepad_name(gamepadName);
//        joyStickConfig.setGamepad_mac(gamepadMac);
//    }
}
